function covar = covarParzenWindow(X)
%D = size(X,2);
L = size(X,1);
col = size(X,2);
distMatrixCovar = zeros(L);

for i = 1 : L
    for j = 1 : L
        dist = 0;
        for k = 1:col
            dist = dist + sqrt(((X(j,k)-X(i,k))^2));
        end
        distMatrixCovar(i,j) = dist;
    end
end

% TOP 10
top10 = zeros(10,L);
for i = 1 : L
    for j = 1 : 10
        noZero = find(distMatrixCovar(i,:)>0);
        [value idx] = min(distMatrixCovar(i,noZero));
        distMatrixCovar(i,idx) = 0;
        top10(j,i) = value;
    end
end

covar = mean(mean(top10));
